package cn.airfei.aircore.testcore.api;

import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import cn.airfei.aircore.core.storage.PageParam;
import cn.airfei.aircore.testcore.storages.dto.UserDto;
import cn.airfei.aircore.testcore.storages.vo.UserVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import cn.airfei.aircore.core.common.Resp;
import java.util.Map;
import java.util.List;
import springfox.documentation.annotations.ApiIgnore;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;


/**
 * <p>
 * 用户表
 * </p>
 *
 * @author air
 * @version v1.0
 * @since 2022-04-25
 */
@Api(value = "用户表", tags = {"User 用户表"})
public interface UserApi {

    @ApiOperation(value = "分页查询（主要针对多表查询），分页参数：{pageCurrent:当前页(必传)，pageSize:分页大小(必传)}")
    @ApiResponses(value = {@ApiResponse(code = 0, message = "0:成功，否则失败",response = Resp.class)})
    Resp<Page<UserVo>> index(@Validated UserDto userDto, BindingResult bindingResult, PageParam pageParam);

    @ApiOperation(value = "查询用户表列表,只查询单表数据，不关联任何表," +
            "列表(qp-参数支持的操作符号有: eq(=),ne(!=),gt(>),lt(<),ge(>=),le(<=),in,like,notLike,likeleft(左边LIKE '%xxx'),likeright(右边LIKE 'xx%'))")
    @ApiResponses(value = {@ApiResponse(code = 0, message = "0:成功，否则失败",response = UserDto.class)})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "qp-id-eq", value = "", paramType = "query" ),

            @ApiImplicitParam(name = "qp-name-eq", value = "用户名", paramType = "query" ),

            @ApiImplicitParam(name = "qp-nickname-eq", value = "昵称", paramType = "query" ),

            @ApiImplicitParam(name = "qp-password-eq", value = "密码（MD5加密）", paramType = "query" ),

            @ApiImplicitParam(name = "qp-ip-eq", value = "ip地址", paramType = "query" ),

            @ApiImplicitParam(name = "qp-email-eq", value = "邮箱", paramType = "query" ),

            @ApiImplicitParam(name = "qp-age-eq", value = "年龄", paramType = "query" ),

            @ApiImplicitParam(name = "qp-gender-eq", value = "性别：1：男，2：女，3：其他", paramType = "query" ),

            @ApiImplicitParam(name = "qp-status-eq", value = "状态：1：正常，2：禁用（待审核）,0：已取消，-1：已删除", paramType = "query" ),

            @ApiImplicitParam(name = "qp-createdAt-gt", value = "", paramType = "query", dataType="date"),
            @ApiImplicitParam(name = "qp-createdAt-le", value = "", paramType = "query", dataType="date"),

            @ApiImplicitParam(name = "qp-updatedAt-gt", value = "", paramType = "query", dataType="date"),
            @ApiImplicitParam(name = "qp-updatedAt-le", value = "", paramType = "query", dataType="date"),

            @ApiImplicitParam(name = "pageCurrent",value = "当前页", paramType = "query", dataType = "long", defaultValue = "1", required = true),
            @ApiImplicitParam(name = "pageSize",value = "分页大小", paramType = "query", dataType = "long", defaultValue = "15", required = true)
    })
    Resp<Page<UserVo>> singleTablePage(@ApiIgnore @RequestParam Map<String,Object> map);

    @ApiOperation(value = "Display the specified resource.")
    @ApiResponses(value = {@ApiResponse(code = 0, message = "0:成功，否则失败")})
    Resp<UserVo> show(@PathVariable("id") String id);

    @ApiOperation(value = "Store a newly created resource in storage.")
    @ApiResponses(value = {@ApiResponse(code = 0, message = "0:成功，否则失败", response = Resp.class)})
    Resp<Integer> store(@RequestBody UserDto userDto);

    @ApiOperation(value = " 支持批量删除，以英文逗号（,） 分割")
    @ApiResponses(value = {@ApiResponse(code = 0, message = "0:成功，否则失败")})
    Resp<Integer> destroy(@PathVariable("ids") String ids);

    @ApiOperation(value = "Update the specified resource in storage.")
    @ApiResponses(value = {@ApiResponse(code = 0, message = "0:成功，否则失败",response = Resp.class)})
    Resp<Integer> update(@RequestBody UserDto userDto);

    @ApiOperation(value = "设置状态，1:正常,2:禁用/待审核，-1:已删除")
    @ApiResponses(value = {@ApiResponse(code = 0, message = "0:成功，否则失败",response = Resp.class)})
    Resp<Boolean> setStatus(Long id,Integer status);

    @ApiOperation(value = "查询用户表列表(不分页),(qp-参数支持的操作符号有: eq(=),ne(!=),gt(>),lt(<),ge(>=),le(<=),in,like,notLike,likeleft(左边LIKE '%xxx'),likeright(右边LIKE 'xx%'))")
    @ApiImplicitParams({
             @ApiImplicitParam(name = "qp-id-eq", value = "", paramType = "query" ),
             @ApiImplicitParam(name = "qp-name-eq", value = "用户名", paramType = "query" ),
             @ApiImplicitParam(name = "qp-nickname-eq", value = "昵称", paramType = "query" ),
             @ApiImplicitParam(name = "qp-password-eq", value = "密码（MD5加密）", paramType = "query" ),
             @ApiImplicitParam(name = "qp-ip-eq", value = "ip地址", paramType = "query" ),
             @ApiImplicitParam(name = "qp-email-eq", value = "邮箱", paramType = "query" ),
             @ApiImplicitParam(name = "qp-age-eq", value = "年龄", paramType = "query" ),
             @ApiImplicitParam(name = "qp-gender-eq", value = "性别：1：男，2：女，3：其他", paramType = "query" ),
             @ApiImplicitParam(name = "qp-status-eq", value = "状态：1：正常，2：禁用（待审核）,0：已取消，-1：已删除", paramType = "query" ),
             @ApiImplicitParam(name = "qp-createdAt-gt", value = "", paramType = "query", dataType="date"),
             @ApiImplicitParam(name = "qp-createdAt-le", value = "", paramType = "query", dataType="date"),
             @ApiImplicitParam(name = "qp-updatedAt-gt", value = "", paramType = "query", dataType="date"),
             @ApiImplicitParam(name = "qp-updatedAt-le", value = "", paramType = "query", dataType="date"),
     })
    @ApiResponses(value = {@ApiResponse(code = 0, message = "0:成功，否则失败",response = Resp.class)})
    Resp<List<UserVo>> getList(@ApiIgnore @RequestParam Map<String,Object> map);

    @ApiOperation(value = "添加多条数据")
    @ApiResponses(value = {@ApiResponse(code = 0, message = "0:成功，否则失败",response = Resp.class)})
    Resp<List<UserVo>> saveBatch(@RequestBody List<UserDto> userDtoList);

    @ApiOperation(value = "更新多条数据（主键id必传）")
    @ApiResponses(value = {@ApiResponse(code = 0, message = "0:成功，否则失败",response = Resp.class)})
    Resp<List<UserVo>> updateBatch(@RequestBody List<UserDto> userDtoList);

}
